package com.example.demo.huawei;

import java.util.Scanner;

/*
垃圾题目 读都读不懂 不是我做的
 最少停车数/停车场车辆统计
 */
public class OD48_2 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String str = scanner.nextLine();

        int count = 0;
        int len = str.length();
        int carNum = 0;
        for (int i = 0; i < len; i += 2) {
            if (str.charAt(i) == '1') {
                if (carNum == 0 || carNum == 3) {
                    carNum = 0;
                    count++;
                }
                carNum++;
            } else {
                carNum = 0;
            }
        }
        System.out.println(count);
    }
}
